<?php
namespace PsiFramework\Classes\Util\UI;

/**
 * PsiFramework
 * Php Simple Framework
 *
 * @author Rémi San
 * @version beta
 */

/**
 * The Response class allows to pass attributes to
 * the presentation pages
 *
 * @package Util.UI
 */
class Response
{

    protected /*array*/ $_attributes ;

    /**
     * Response contructor
     */
    public function __construct()
    {
        $this->_attributes = array();
    }

    /**
     * This function allows to retrieve all the attributes
     *
     * @return array
     */
    public function getAllAttributes()
    {
        return $this->_attributes ;
    }

    /**
     * This function allows to retrieve an attribute
     * matching the specified name
     *
     * @param $name         the name of the attribute to retrieve
     * @return mixed
     */
    public function getAttribute(/*string*/ $name)
    {
        $return = null ;
        if (isset($this->_attributes[$name])) {
            $return = $this->_attributes[$name] ;
        }
        return $return ;
    }

    /**
     * This function allows to add an attribute
     *
     * @param $name                 the name of the attribute
     * @param $attribute    the value of the attribute
     */
    public function setAttribute(/*string*/ $name, /*mixed*/ $attribute)
    {
        $this->_attributes[$name] = $attribute ;
    }

}
